﻿dynamic class com.crystalcentral.model.DiyItem
{
	private var _type:String;
	private var _x:Number;
	private var _y:Number;
	private var _width:Number;
	private var _height:Number;
	private var _xscale:Number;
	private var _yscale:Number;
	private var _rotation:Number;

	public function DiyItem()
	{
		if (arguments.length == 0)
		{
			this._type = "text";
			this._x = 0;
			this._y = 0;
			this._width = 200;
			this._height = 100;
			this._xscale = 100;
			this._yscale = 100;
			this._rotation = 0;
		}
		else
		{
			var node:XMLNode = arguments[0];
			this._type = node.attributes.tag;
			this._x = Number(node.attributes.x == undefined ? 0 : node.attributes.x);
			this._y = Number(node.attributes.y == undefined ? 0 : node.attributes.y);
			this._width = Number(node.attributes.w == undefined ? 100 : node.attributes.w);
			this._height = Number(node.attributes.h == undefined ? 100 : node.attributes.h);
			this._xscale = Number(node.attributes.xs == undefined ? 100 : node.attributes.xs);
			this._yscale = Number(node.attributes.ys == undefined ? 100 : node.attributes.ys);
			this._rotation = Number(node.attributes.rotation == undefined ? 0 : node.attributes.rotation);
		}
	}

	public function get type()
	{
		return _type;
	}
	public function set type(val:String)
	{
		this._type = val;
	}

	public function get x()
	{
		return _x;
	}
	public function set x(val:Number)
	{
		this._x = val;
	}

	public function get y()
	{
		return _y;
	}
	public function set y(val:Number)
	{
		this._y = val;
	}

	public function get width()
	{
		return _width;
	}
	public function set width(val:Number)
	{
		this._width = val;
	}

	public function get height()
	{
		return _height;
	}
	public function set height(val:Number)
	{
		this._height = val;
	}

	public function get xscale()
	{
		return _xscale;
	}
	public function set xscale(val:Number)
	{
		this._xscale = val;
	}

	public function get yscale()
	{
		return _yscale;
	}
	public function set yscale(val:Number)
	{
		this._yscale = val;
	}

	public function get rotation()
	{
		return _rotation;
	}
	public function set rotation(val:Number)
	{
		this._rotation = val;
	}
	
	public function clone() {
		var obj = new DiyItem();
		obj._x=this._x;
		obj._y=this._y;
		obj._width=this._width;
		obj._height=this._height;
		obj._xscale=this._xscale;
		obj._yscale=this._yscale;
		obj._rotation=this._rotation;
		
		return obj;
	}
}